package com.heer.api.callback;

import android.util.Log;

import com.heer.api.CallManager;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by JS01 on 2016/6/14.
 * 使用Retrofit2 Call异步请求时的回调
 */
public abstract class BaseCallback<T> implements Callback<T> {

    private static final String TAG = "BaseCallback";

    @Override
    public void onResponse(Call<T> call, Response<T> response) {
        Log.d(TAG, "code:" + response.code());
        CallManager.remove(call);
    }

    @Override
    public void onFailure(Call<T> call, Throwable t) {
        Log.d(TAG, "error:" + t.getLocalizedMessage());
        CallManager.remove(call);
    }


}
